Skip to content

Instantly share code, notes, and snippets.

Penn Su pencilcheck

Block or report user

Report or block pencilcheck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
kitze / conditionalwrap.js
Created Oct 25, 2017
one-line React component for conditionally wrapping children
View conditionalwrap.js
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
wrap={children => <a href="/">{children}</a>}
ziluvatar / token-generator.js
Last active Dec 6, 2019
Example of refreshing tokens with jwt
View token-generator.js
* Example to refresh tokens using
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
* I create this gist just to help those who want to auto-refresh JWTs.
const jwt = require('jsonwebtoken');
jakebrinkmann /
Created Jul 3, 2017
Read SQL query from psycopg2 into pandas dataframe
import pandas as pd
import as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
rochacbruno /
Last active Sep 16, 2019
Docker-compose wait-to-start

When unsing docker compose you can have a problem with the order of dependent linked containers

The solution is to start a script which tries to access a service and waits until it gets ready before loading your program

garthk / profile
Created Jun 21, 2015
boot2docker 1.7.0 cert fix
View profile
wait4eth1() {
until ip a show eth1 | grep -q UP
[ $((CNT++)) -gt 60 ] && break || sleep 1
sleep 1
pnc /
Last active Nov 30, 2019
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
nnarhinen /
Last active Jun 25, 2019
Rails-like console with express.js, bookshelf.js and node-repl-promised

Install node-repl-promised: npm install -g repl-promised

Use the repl to list all users

$ node-promised
> var app = require('./app');
> var Bookshelf = app.get('bookshelf');
peihsinsu /
Created Sep 19, 2014
GCE daily scheduling snapshot backup
# Environments
export PATH=/root/google-cloud-sdk/bin:$PATH
# Daily create snapshot for "backup_path" listed disks
# And remove snapshot 1 week old before
# Create snap date
export DT=`date +%Y%m%d`
iamkirkbater / autoSizr.js
Created Aug 6, 2014
Simple jQuery Plugin that auto resizes text to fill a specific sized div (great for responsive slideshows that utilize large banner text with variable lengths), derived from
View autoSizr.js
$.fn.autoSizr = function () {
var el, elements, _i, _len, _results;
elements = $(this);
if (elements.length < 0) {
_results = [];
for (_i = 0, _len = elements.length; _i < _len; _i++) {
el = elements[_i];
_results.push((function(el) {
You can’t perform that action at this time.