Skip to content

Instantly share code, notes, and snippets.

@PixelSergey
PixelSergey / wireless.md
Last active March 26, 2024 00:24
FTP guide

Transferring files wirelessly between your 3DS and computer

This is especially useful if you do not have an SD card reader or if you do not want to open the New 3DS' pesky shell.

There are two options: the official MicroSD management (New 3DS only) (Requires Windows) or FTPD (must have CFW or homebrew installed).

FTPD is quicker and easier to use in the long run and can be used on all systems and computers (and phones!); however, MicroSD management is official and can be done with a stock system.



@PixelSergey
PixelSergey / pyramid.sh
Last active October 10, 2019 06:11
Asterisk pyramid
#!/bin/bash
sudo curl -s -L gist.github.com/PixelSergey/58c86ae2d2fdea9d3327995d6e773b81/raw/setup.sh | sudo bash /dev/stdin arg1 arg2
echo "Asterisk pyramid!"
declare -i n=20
for (( i = 1; i <= n; i++ )); do
for (( k = i; k <= n; k++ )); do
echo -ne " "
done
for (( j = 1; j <= 2 * i - 1; j++ )); do
@vermaslal
vermaslal / README.MD
Last active October 1, 2021 02:38
Drop Root Privileges in Node.js when using port <1024

A common use for Node.js is to build web applications. Usually, we want these applications to listen on port 80. As a security precaution, most OS’s require root privileges for this to happen (e.g. OS X, Linux, BSD). To run a Node application this way, we need to do the following:

sudo node server.js

Then, the application runs as root for the rest of the session. There are potential security risks to this, though. What if there is a vulnerability in your application and a hacker starts controlling your app and doing naughty things with it? Thankfully, we can drop the user account running our process to a less secured user, such as our normal account. There are two methods on the process global which can handle this for us, .setgid() and .setuid().

Here’s a working example of this in action. We want to run this code AFTER we bind to port 80, so we run the code in a callback:

@xposedbones
xposedbones / map.js
Last active May 1, 2024 11:15
Javascript Map range of number to another range
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
@Lunchbox4K
Lunchbox4K / KeyboardHook.cs
Last active December 11, 2023 07:13
C# Global Keyboard Hooks
// MP Hooks © 2016 Mitchell Pell
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace mp.hooks{
@subfuzion
subfuzion / curl.md
Last active May 16, 2024 18:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@sylt
sylt / ncurses_mouse_movement.c
Created November 22, 2015 20:17
Mouse movement example for NCURSES
// I had problems getting mouse movement events working in ncurses, but after
// some research, it seems as if this is how you can do it. The magic is in the
// printf("\033[?1003h\n") which was the missing piece in the puzzle for me
// (see console_codes(4) for more information). 1003 means here that all events
// (even position updates) will be reported.
//
// This seems to work in at least three X-based terminals that I've tested:
// xterm, urxvt and gnome-terminal. It doesn't work when testing in a "normal"
// terminal, with GPM enabled. Perhaps something for the next gist version? :)
@ishan1608
ishan1608 / heater.py
Last active May 2, 2024 16:28
A python script to heat your computer so that your fingers can work upon your laptop in winter.
"""Heater
A program that spawns as much number of processes as there are CPUs on the computer.
This keeps the core temprature high.
I made this so that my fingers feel more comfortable while working on my laptop during winter.
Caution : An eye should be kept on the CPU temprature so that when it is getting too hot,
the prgoram needs to be killed; else it can damage the CPU.
Author : Ishan
Email : ishanatmuzaffarpur@gmail.com
"""
@roachhd
roachhd / README.md
Last active May 22, 2024 09:24
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

@nl5887
nl5887 / transfer.fish
Last active March 22, 2022 09:07
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
function transfer
if test (count $argv) -eq 0
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
end
## get temporarily filename, output is written to this file show progress can be showed
set tmpfile ( mktemp -t transferXXX )
## upload stdin or file