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
View Preventing-Puppeteer-Detection.md

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 = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',
@kitze
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}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@ziluvatar
ziluvatar / token-generator.js
Last active Dec 6, 2019
Example of refreshing tokens with jwt
View token-generator.js
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* 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
jakebrinkmann / connect_psycopg2_to_pandas.py
Created Jul 3, 2017
Read SQL query from psycopg2 into pandas dataframe
View connect_psycopg2_to_pandas.py
import pandas as pd
import pandas.io.sql 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
rochacbruno / ACCESS_ELASTIC.md
Last active Sep 16, 2019
Docker-compose wait-to-start
View ACCESS_ELASTIC.md

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
garthk / profile
Created Jun 21, 2015
boot2docker 1.7.0 cert fix
View profile
wait4eth1() {
CNT=0
until ip a show eth1 | grep -q UP
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
}
wait4eth1
@pnc
pnc / observer.md
Last active Nov 30, 2019
Using Erlang observer/appmon remotely
View observer.md

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
nnarhinen / README.md
Last active Jun 25, 2019
Rails-like console with express.js, bookshelf.js and node-repl-promised
View README.md

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

Use the repl to list all users

$ node-promised
> var app = require('./app');
undefined
> var Bookshelf = app.get('bookshelf');
undefined
@peihsinsu
peihsinsu / gce-snapshot.sh
Created Sep 19, 2014
GCE daily scheduling snapshot backup
View gce-snapshot.sh
#!/bin/bash
# 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
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 https://gist.github.com/iam4x/5015270
View autoSizr.js
$.fn.autoSizr = function () {
var el, elements, _i, _len, _results;
elements = $(this);
if (elements.length < 0) {
return;
}
_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.