Skip to content

Instantly share code, notes, and snippets.

@dideler
dideler / bot.rb
Last active May 8, 2024 01:20
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@noobnooc
noobnooc / cloudflare-worker-proxy.js
Last active May 1, 2024 15:04
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@gnarf
gnarf / ..git-pr.md
Last active April 12, 2024 22:00
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@perky
perky / ProFi.lua
Created May 30, 2012 20:32
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
@NyaMisty
NyaMisty / _CoCoPilot.md
Last active January 26, 2024 03:44
A small snippet to use CoCoPilot without patching Copilot plugin

cocopilot-gh-enterprise

Turn cocopilot into github enterprise server, so that we can use CoCoPilot without patching Copilot plugin.

Usage

  1. Add the following JS to a cloudflare worker.
  2. Add Cloudflare Worker Routes: *cocopilot-gh-enterprise.XXXXXXXX.XXX. You should also add DNS records cocopilot-gh-enterprise.XXXXXXXX.XXX & *.cocopilot-gh-enterprise.XXXXXXXX.XXX to make the route available image
  3. Setting GitHub Enterprise URL to cocopilot-gh-enterprise.XXXXXXXX.XXX
@c-kick
c-kick / hnl.mobileConsole.js
Last active January 14, 2024 18:24
NOTE: V2 Released! Seehttps://github.com/c-kick/mobileConsole hnl.mobileConsole.js - extends JavaScript's console to display a visual console inside the webpage. Very usefull for debugging JS on mobile devices with no real console. Info and demo: http://www.hnldesign.nl/work/code/mobileconsole-javascript-console-for-mobile-devices/
/*!
*
* NEW VERSION AT https://github.com/c-kick/mobileConsole
*
* hnl.mobileConsole - javascript mobile console - v1.3.8 - 04/01/2021
* Adds html console to webpage. Especially useful for debugging JS on mobile devices.
* Supports 'log', 'trace', 'info', 'warn', 'error', 'group', 'groupEnd', 'table', 'assert', 'clear'
* Inspired by code by Jakub Fiala (https://gist.github.com/jakubfiala/8fe3461ab6508f46003d)
* Licensed under the MIT license
*
@duzun
duzun / enableSelect-bookmarklet.html
Last active December 22, 2023 08:04
Enable Right Click and Text Selection Bookmarklet
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d){var a=d.document,h=function(){},c=a.body||a.getElementsByTagName("body")[0],f=a.documentElement||a.getElementsByTagName("html")[0],k=[c,f,a],l=["webkit","khtml","moz","ms",""],g=["contextmenu","selectstart","select","mousedown","mouseup"],b=d.Selection,e=b&&b.prototype;e&&(e.removeAllRanges=h,b=a.selection)&&(b.clear=h);for(e=k.length;e--;)if(f=k[e]){for(b=g.length;b--;)f["on"+g[b]]=null;if(a=f.style)for(a.cursor="",a.webkitTouchCallout="initial",b=l.length;b--;)a[((c=l[b])?"-"+c+"-":c)+"user-select"]="initial"}(c=d.jQuery||d.Zepto)&&c(d).off(g)})(this);">
Enable Select
</a>
@Shujito
Shujito / spotihosts
Last active November 29, 2023 06:56
The hosts file entries to block Spotify audio ad servers.
# taken from here:
# https://www.reddit.com/r/Piracy/comments/4kn6rq/comprehensive_guide_to_blocking_ads_on_spotify/
0.0.0.0 adclick.g.doublecklick.net
0.0.0.0 adeventtracker.spotify.com
0.0.0.0 ads-fa.spotify.com
0.0.0.0 analytics.spotify.com
0.0.0.0 audio2.spotify.com
0.0.0.0 b.scorecardresearch.com
0.0.0.0 bounceexchange.com
0.0.0.0 bs.serving-sys.com
@ukaserge
ukaserge / bookmarklet.js
Created February 2, 2023 04:59 — forked from andyg2/bookmarklet.js
Bookmark-let to summarize a web page using GPT-3 - written by GPT-3
javascript: (function () {
var text = document.body.innerText;
var spl = text.split(" ");
if (spl.length > 3000) {
text = spl.slice(0, 3000).join(" ");
}
fetch('https://api.openai.com/v1/completions', {
method: 'POST',
headers: {