Skip to content

Instantly share code, notes, and snippets.

@sbz
sbz / tty-size.c
Created April 14, 2017 02:05
get terminal size using ioctl get win size (TIOCGWINSZ) in C
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
int
main(void) {
struct winsize ws;
ioctl(STDIN_FILENO, TIOCGWINSZ, &ws);
printf ("lines %d\n", ws.ws_row);
@juanbrujo
juanbrujo / PlayStationBIOSFilesNAEUJP.md
Last active May 1, 2024 13:35
Files for PlayStation BIOS Files NA-EU-JP
@iceener
iceener / index.ts
Created May 1, 2024 13:28
heyalice.app — Node.js server example
import express from 'express';
import { OpenAI } from 'openai';
const app = express();
const openai = new OpenAI({
apiKey: 'API_KEY'
});
app.use(express.json());
@edokeh
edokeh / index.js
Last active May 1, 2024 13:33
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@cedrickchee
cedrickchee / llama-7b-m1.md
Last active May 1, 2024 13:33
4 Steps in Running LLaMA-7B on a M1 MacBook with `llama.cpp`

4 Steps in Running LLaMA-7B on a M1 MacBook

The large language models usability

The problem with large language models is that you can’t run these locally on your laptop. Thanks to Georgi Gerganov and his llama.cpp project, it is now possible to run Meta’s LLaMA on a single computer without a dedicated GPU.

Running LLaMA

There are multiple steps involved in running LLaMA locally on a M1 Mac after downloading the model weights.

@dlaehnemann
dlaehnemann / contribute_github_without_write_access.md
Last active May 1, 2024 13:32
contributing to github repo without write access: pull from origin repo, push to your own fork

Whenever I want to create pull requests to a repo that I don't have write access to, I:

  1. Fork the original repo to my account.
  2. Clone the original repo to my local machine.
  3. Add my fork as an additional remote and make it the push default.
  4. Make changes in a new branch locally.
  5. Push this branch to my fork.
  6. Create a pull request from there.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 1, 2024 13:31
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@NeilMasters
NeilMasters / delete-all-facebook-photos.js
Created December 6, 2022 11:45
Javascript to delete all of your facebook photos without having to do it manually.
/**
* Run this in your browser console and it will delete all of your facebook photos
* one after another.
*
* You will most likely need to fiddle with the css selectors but its basically:
* 1. Click edit of first photo
* 2. Click delete in dropdown menu
* 3. Click confirm in dialog
*/
setInterval(() => {
@penguinpowernz
penguinpowernz / README.md
Last active May 1, 2024 13:31
WPA CLI commands
command args description
status [verbose] get current WPA/EAPOL/EAP status
ifname get current interface name
ping pings wpa_supplicant
relog re-open log-file (allow rolling logs)
note <text> add a note to wpa_supplicant debug log
mib get MIB variables (dot1x, dot11)
help [command] show usage help
interface [ifname] show interfaces/select interface
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active May 1, 2024 13:29
set -e, -u, -o, -x pipefail explanation