Skip to content

Instantly share code, notes, and snippets.

View switchswap's full-sized avatar
🎷
Jazz for your soul!

Swap switchswap

🎷
Jazz for your soul!
View GitHub Profile
@wasabili
wasabili / aznyan.c
Created October 22, 2010 15:40
Aznyan AA
int
stk
[ 2 << 14
]; int ps = 0; int kofi(){char
a [ 2 << 15 ]; int c[ 2<<
15 ];int n;
int s;char d[ 2<<
14 ];int p ; int
@macloo
macloo / local_db_setup.py
Created April 15, 2016 00:13
If you have a MySQL database in XAMPP, and you're running a Flask app locally that needs to connect to that database, this works.
#!/Users/username/Documents/python/projectname/env/bin/python
# edit line 1 to match what YOU get when you are in YOUR virtualenv and type: which python
# NO SPACES in first 3 chars in line 1: #!/
# make sure env is activated!
# make sure you have "started all" in XAMPP!
# code below works for a MySQL database in XAMPP on Mac OS
# pymysql can be installed with pip: pip install PyMySQL
import pymysql
@Gobot1234
Gobot1234 / Sub-Classing Help.MD
Last active July 29, 2021 09:16
A guide to sub-classing help with discord.py

Subclassing the help command in discord.py

This is going to be a short-ish guide on sub-classing help as ?tag new help isn't great at explaining things.

Choosing which help command to subclass

  1. Don't subclass HelpCommand unless you're going to override every one of the send_x methods, because that class does not do anything (it literally just returns None)
  2. DefaultHelpCommand is for the default help command (the code block one) Example of the default help command class
  3. MinimalHelpCommandis a minimalistic version of the help command, this is an example of the command produced if you copy ?tag new helpExample of the minimal help command class
  4. HelpCommand is a completely blank slate and can be subclassed to look any way you want, although most people use them for embeds ![My example of a help co
@taichikuji
taichikuji / README.md
Last active July 25, 2024 08:36
Get a DDNS up and running with DuckDNS - Step by Step

Get a DDNS up and running with DuckDNS - Step by Step

Understanding DDNS

In summary, DDNS stands for Dynamic DNS. DDNS updates a DNS name in real-time to point to a changing IP address. This is useful for devices without a static IP. For example, companies like Google use static IPs and IP ranges, which are more expensive than ephemeral IPs and IP ranges. DDNS provides a cost-effective alternative, linking a hostname to a dynamic IP address.

How Does DDNS Work?

To use DDNS, you need an account with a DDNS provider. While some services are paid, they are still cheaper than static public IPs from ISPs. A script or service on your device updates the DDNS server with your current IP at regular intervals to maintain the link between your hostname and IP address. Luckily for us, DuckDNS is free for everybody and relays on donations to keep their services running.

@csandman
csandman / README.md
Last active October 11, 2023 10:23
Chakra UI React Select

Chakra React Select

UPDATE: I finally made an NPM package for this component! It is made with TypeScript, and now has a fully customizable styling system. It is also far ahead of this wrapper at this point. Check it out here if you'd like: https://github.com/csandman/chakra-react-select

In order to use this component, you can implement it and use it like you would normally use react-select. It should accept all of the props that the original takes, however customizing the theme or the components could break this implementation. There are also a few extra things you can do with this wrapper that pull from the chakra library.

  • You can pass the size prop with either sm, md, or lg. These will reflect the sizes available on the Chakra <Input /> component (with the exception of xs because it's too small to work).
  • In your options objects, you can add the key isFixed to emulate the exa
import { useQuery } from 'react-query'
import { stringify } from 'qs'
/* We could read this from some config or env */
const API_ROOT = 'https://api.example.com'
/* A helper function to create URL from path and params */
function getUrl(path, params) {
let url = API_ROOT + path
import { useCallback } from 'react'
import { useMutation } from 'react-query'
import { stringify } from 'qs'
/* We could read this from some config or env */
const API_ROOT = 'https://api.example.com'
/* A helper function to create URL from path and params */
function getUrl(path) {
return API_ROOT + path