Skip to content

Instantly share code, notes, and snippets.

@Alexey-N-Chernyshov
Alexey-N-Chernyshov / client.c
Last active March 29, 2024 06:56
Example of client/server with select().
// Simple example of client.
// Client prints received messages to stdout and sends from stdin.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/select.h>
#include <netinet/in.h>
@MuhsinFatih
MuhsinFatih / pythondoneright.md
Last active March 29, 2024 06:56
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.
@OrionReed
OrionReed / DOM3D.js
Last active March 29, 2024 06:56
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@juanbrujo
juanbrujo / PlayStationBIOSFilesNAEUJP.md
Last active March 29, 2024 06:53
Files for PlayStation BIOS Files NA-EU-JP
@c0rp-aubakirov
c0rp-aubakirov / ClientInfo.java
Last active March 29, 2024 06:50
How to get full client info using servlet request, including client IP, browser, os, use-agent and referer
public void printClientInfo(HttpServletRequest request) {
final String referer = getReferer(request);
final String fullURL = getFullURL(request);
final String clientIpAddr = getClientIpAddr(request);
final String clientOS = getClientOS(request);
final String clientBrowser = getClientBrowser(request);
final String userAgent = getUserAgent(request);
logger.info("\n" +
@darkglow88-john
darkglow88-john / index.html
Created March 29, 2024 06:49
Responsive Audio Player
<div class="container">
<div class="column add-bottom">
<div id="mainwrap">
<div id="nowPlay">
<span id="npAction">Paused...</span><span id="npTitle"></span>
</div>
<div id="audiowrap">
<div id="audio0">
<audio id="audio1" preload controls>Your browser does not support HTML5 Audio! 😢</audio>
</div>
@gbaman
gbaman / HowToOTG.md
Last active March 29, 2024 06:49
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@eirikb
eirikb / qemu-arch-linux-raspi2.sh
Last active March 29, 2024 06:42
Arch Linux in QEMU for Raspberry Pi 2
#!/usr/bin/env bash
echo
echo "Arch Linux in QEMU with love from eirikb"
echo
set -x
TARGET=ArchLinuxARM-rpi-armv7-latest.tar.gz
wget "http://os.archlinuxarm.org/os/$TARGET"
@krisbolton
krisbolton / fix-USB-showing-up-as-two-partitions.md
Last active March 29, 2024 06:39
How to fix a USB drive showing up as two drives (fragmented into multiple partitions) on Windows

How to fix a USB drive showing up as two drives (fragmented into multiple partitions) on Windows:

  1. Hold the Windows key and press X, select PowerShell (Admin), select Yes to the pop-up. You can also use Command Prompt.
  2. In the Powershell interface type diskpart to enter the disk partition tool.
  3. Type list disk to see all disks listed.
  4. Select the USB drive by typing select disk [NUMBER]. Be careful to select the correct drive.
  5. Type clean. An error will occur if you have the drive folder open, close the window and repeat the command if this happens.
  6. Type create partition primary.
  7. Type format fs=ntfs quick to format the drive (you can also choose to set fs=fat32).
  8. Type active.
@johnz133
johnz133 / elon_musk_use_commencement_speech_transcript
Last active March 29, 2024 06:37
Elon Musk USC Commencement Speech Transcript.
Alright, thank you.
So, I’ve got about apparently I’ve got about five to six minutes to say the most useful things I can think of.
I’m gonna do my best.
It was suggested that I distill things down to 3 items.
I think I’ll go with four.
And I’ll try, I think, I think these are pretty important ones.
Some of it may kinda sound like, well you’ve heard them before.
But, you know, worth reemphasizing.
I think the first is, you need to work, if you, depending on how well you want to do,