Skip to content

Instantly share code, notes, and snippets.

@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active May 17, 2024 23:43
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
-- This presents an example of rendering templates in the database.
-- DO NOT DO THIS! It's a terrible idea, and just example for my talk
-- which you can see at https://speakerdeck.com/andrewgodwin/dubious-database-design
CREATE EXTENSION plpythonu;
-- Table to store template HTML by name
CREATE TABLE templates (
"name" text PRIMARY KEY,
"template" text
@Manouchehri
Manouchehri / cloudflare.sh
Last active May 15, 2024 02:55
Allow CloudFlare only
# Source:
# https://www.cloudflare.com/ips
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables-
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
# Avoid racking up billing/attacks
# WARNING: If you get attacked and CloudFlare drops you, your site(s) will be unreachable.
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP
@n370
n370 / 20150309_firebase_batch_push.md
Last active June 21, 2020 19:57
Using jq, HTTPie and the Firebase REST API to push JSON objects from your terminal.

Using jq, HTTPie and the Firebase REST API to push JSON objects from your terminal.

Imagine a scenario where you've been developing locally with dummy data and at some point decided to move this data to a Firebase instance.

Assuming your JSON file contents looks like the following.

[ 
  {
    "name": "Zapallo Anco",
@gregsh
gregsh / - IDE Scripting.md
Last active March 13, 2024 03:29
IDE Scripting

Here are my attempts to script an IntelliJ-based IDE using javax.script.* API (ex-JSR-223).

The list of available scripting languages and engines:

  1. Groovy - built-in, via Groovy jars and <app>/lib/groovy-jsr223-xxx.jar
  2. JavaScript (Nashorn) - built-in, via Java Runtime <app>/jbr/... (deprecated and will be removed soon)
  3. JavaScript (GraalJS) - https://plugins.jetbrains.com/plugin/12548-intellij-scripting-javascript
  4. JPython - https://plugins.jetbrains.com/plugin/12471-intellij-scripting-python
  5. JRuby - https://plugins.jetbrains.com/plugin/12549-intellij-scripting-ruby
  6. Clojure - https://plugins.jetbrains.com/plugin/12469-intellij-scripting-clojure

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@jdp
jdp / jarg.py
Last active August 29, 2015 14:09
JSON shorthand for your CLI
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import sys
class InvalidJSONError(ValueError):
def __init__(self, key, *args, **kwargs):
self.key = key
@jkbrzt
jkbrzt / install-python.sh
Last active August 26, 2016 14:43
Download, compile, and install Python on RHEL or CentOS. Tested with CentOS 6 + Python 2.7.3 and CentOS 7 + Python 3.4.1
VERSION="3.4.1"
yum -y install gcc openssl-devel
rm -rf Python-${VERSION}*
wget https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz
tar -xvzf Python-${VERSION}.tgz
cd Python-${VERSION}
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
echo "/usr/local/lib" > /etc/ld.so.conf.d/custom-python.conf
make && make altinstall
@nojvek
nojvek / Tinder Auto-liker
Last active November 12, 2021 18:28
Tinder Auto-liker script
<?php
// Licence: WTFPL ! http://www.wtfpl.net/about/
$fbAuth = array("facebook_id" => "123456789", "facebook_token" => "<Use charles proxy to do man-in-middle SSL sniffing and extract fb token>");
// Do the magic.
$tinderToken = tinderCall("auth", "token", $fbAuth); // Authenticate
$authToken = "X-Auth-Token: $tinderToken\r\nAuthorization: Token token=\"$tinderToken\"\r\n";
@staltz
staltz / introrx.md
Last active May 18, 2024 05:17
The introduction to Reactive Programming you've been missing