Skip to content

Instantly share code, notes, and snippets.

Esfand esfand

Block or report user

Report or block esfand

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
@esfand
esfand / utf8.c
Created Aug 14, 2019 — forked from stanislaw/utf8.c
Some C functions to work with UTF-8 string : you can check if a string is valid UTF-8, get the length of a UTF-8 string and replace things in a UTF-8 string. All `char *` arguments must be regular, null-byte terminated, C strings. I've tried to optimize the best I could. I'd be grateful for any suggestions or improvements. Please note I have onl…
View utf8.c
//
// utf8.c
// training
//
// Created by Conrad Kleinespel on 5/27/13.
// Copyright (c) 2013 Conrad Kleinespel. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
@esfand
esfand / javascript-promise-timeout.js
Last active Jul 18, 2018 — forked from john-doherty/javascript-promise-timeout.js
Adds a timeout to a JavaScript promise, rejects if not resolved within timeout period
View javascript-promise-timeout.js
/**
* Wraps a promise in a timeout, allowing the promise to reject
* if not resolved within a specified period of time.
* @param {integer} ms - milliseconds to wait before rejecting
* promise if not resolved
* @param {Promise} promise to monitor
* @Example
* promiseTimeout(1000, fetch('https://courseof.life/johndoherty.json'))
* .then(function(cvData){
* alert(cvData);
@esfand
esfand / background.js
Last active Jul 12, 2018 — forked from chrahunt/background.js
Chrome extension for testing chrome.storage.local.
View background.js
(function(window, document, undefined) {
var Storage = {};
window.Storage = Storage;
Storage.tracking = true;
Storage.track = function() {
Storage.tracking = !Storage.tracking;
if (Storage.tracking) {
console.log("Tracking storage performance.");
@esfand
esfand / hovercard.go
Created Jul 10, 2018 — forked from linxlunx/hovercard.go
Twitter User Hovercard Endpoint
View hovercard.go
package main
import (
"fmt"
"log"
"io/ioutil"
"net/http"
"encoding/json"
"regexp"
"strings"
View twitter-auto-follow-activity
var secondes = Math.floor((Math.random() * 10) + 3);
var duration = secondes;
$('#activity-popup-dialog-body').find('.not-following').find('button.follow-button').each(function() {
var _this = this;
setTimeout(function() {
$(_this).trigger('click');
}, duration * 1000);
duration += secondes;
View twitter.css
@-moz-document domain("twitter.com")
{
/* custom options */
:root
{
--bg1: #1d1e2a !important;
--bg2: #14151F !important;
--text1: #aaa !important;
@esfand
esfand / _webfaction_setup.rst
Created Jun 16, 2018 — forked from k4ml/_webfaction_setup.rst
setting up a stack on webfaction
View _webfaction_setup.rst

Setting up Webfaction for modern Python deployment

last updated: 4/5/2011

note that this stuff is always a moving target, much of this has been cribbed and combined from various blog posts. Much of the information was out of date from those, and if it is more than a couple months after the last updated date above, consider some of this likely to now be out of date.

@esfand
esfand / nginx-0765-installer.txt
Created Jun 16, 2018 — forked from robflaherty/nginx-0765-installer.txt
Nginx 0.7.65 installer for Webfaction
View nginx-0765-installer.txt
-----BEGIN WEBFACTION INSTALL SCRIPT-----
#!/bin/env python2.4
"""
Nginx 0.7.65 Installer New
"autostart": not applicable
"extra info": Enter domain name for the nginx app
"""
@esfand
esfand / build_nginx_from_source.sh
Created Jun 15, 2018 — forked from a-luna/build_nginx_from_source.sh
Shell Script: Build NGINX from Source with Third Party Modules (Cache Purge, GeoIP2), Completely Non-Interactive, No User Input Required
View build_nginx_from_source.sh
#!/bin/bash -e
# build_nginx_from_source.sh
# Author: Aaron Luna
# Website: alunablog.com
#
# This script downloads the source code for the latest version of NGINX
# (libraries required to build various NGINX modules are also downloaded)
# and builds NGINX according to the options specified in the ./configure
# command. Many of the possible configuration options are explained at
# the link below:
@esfand
esfand / ubuntu-php7-install.bash
Created May 29, 2018 — forked from jaswrks/ubuntu-php7-install.bash
Ubuntu 14.04 PHP7 (Install from Source)
View ubuntu-php7-install.bash
#!/usr/bin/env bash
sudo -i;
apt-get update;
apt-get install --yes \
git \
bison \
autoconf \
You can’t perform that action at this time.