Skip to content

Instantly share code, notes, and snippets.

View statico's full-sized avatar

Ian Langworth ☠ statico

View GitHub Profile
@pauloricardomg
pauloricardomg / cors.nginxconf
Last active March 8, 2024 18:31
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@ruby0x1
ruby0x1 / tilt.shift.glsl
Last active February 19, 2024 02:46
Tilt shift shader, modified from something @grapefrukt gave me
// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/)
// Read http://notes.underscorediscovery.com/ for context on shaders and this file
// License : MIT
uniform sampler2D tex0;
varying vec2 tcoord;
varying vec4 color;
/*
Take note that blurring in a single pass (the two for loops below) is more expensive than separating
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@gdetrez
gdetrez / powerline-test.sh
Last active November 19, 2023 04:07
Powerine font test
#!/bin/bash
echo -e "Powerline glyphs:\n\
Code points Glyphe Description Old code point
U+E0A0 \xee\x82\xa0 Version control branch (U+2B60 \xe2\xad\xa0 )\n\
U+E0A1 \xee\x82\xa1 LN (line) symbol (U+2B61 \xe2\xad\xa1 )\n\
U+E0A2 \xee\x82\xa2 Closed padlock (U+2B64 \xe2\xad\xa4 )\n\
U+E0B0 \xee\x82\xb0 Rightwards black arrowhead (U+2B80 \xe2\xae\x80 )\n\
U+E0B1 \xee\x82\xb1 Rightwards arrowhead (U+2B81 \xe2\xae\x81 )\n\
U+E0B2 \xee\x82\xb2 Leftwards black arrowhead (U+2B82 \xe2\xae\x82 )\n\
@csandman
csandman / debounce-swr.js
Last active November 17, 2023 09:12
Debounce useSwr
// originally from: https://github.com/vercel/swr/issues/110#issuecomment-552637429
import useSWR from 'swr';
import useDebounce from 'hooks/use-debounce';
const App = () => {
const [search, setSearch] = useState('');
const debouncedSearch = useDebounce(search, 1000);
const { data: res, isValidating } = useSWR(
() => debouncedSearch ? `/api/suggestion?value=${debouncedSearch}` : null,
Api.fetcher,
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@statico
statico / 00_statico.link_README.md
Last active September 24, 2023 12:15
Ian's Personal Short Link Bookmark Service
15:39 <@rjbs> Last night, I dreamed I was a rapper.
15:39 <@rjbs> I was asked to come to the funeral of a fan I had never met and eulogize her.
15:40 <@arcanez> did you?
15:40 <@autarch> and you laid down some mad rhymez there?
15:41 <@rjbs> No, I did my best to do a good job. I think I was part of a duo and my counterpart did not take things as seriously.
15:41 <@hanekomu> certainly repressed sexual desires or traumatic events, as Freud would say. :)
15:42 * rjbs watches the cornfield out the window.
15:42 < daxelrod> Nah, he would chalk it up to repressed sexual desires *for* traumatic events
15:47 * stevan would totally take a rjbs/stevan rap duo seriously
15:47 <@stevan> the Moose-Tang Clan
@nealey
nealey / slack-emoji-bulk-delete.js
Last active May 25, 2023 23:09
Bulk delete every custom emoji in Slack
//
// I just found out that we have a bunch of NSFW emoji in our bulk-imported set of >4000 emoji.
// Rather than weed them out, I want to start with a blank slate. This code does that.
//
// Navigate to your "Custom Emoji" page, the one with all the delete buttons.
// Delete one of them and acknowledge that it's going away forever.
// Then open the JavaScript console and paste this in.
//
// At some point your JavaScript console will start spewing errors.
// Reload the Emoji page, delete one emoji by hand again, and paste this in again to resume.
@fuxingloh
fuxingloh / app.js
Last active February 24, 2023 16:16
How to use express.js and passport.js with G Suite SAML Apps SSO
const express = require('express')
const SamlStrategy = require('passport-saml').Strategy
const passport = require('passport')
const cookieSession = require('cookie-session')
const cookieParser = require('cookie-parser')
// Create express instance
const app = express()