Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chenshuo
chenshuo / waiter.h
Last active April 23, 2024 10:02
A handful of implementations of Waiter class for discussion.
#include <boost/noncopyable.hpp>
#include <pthread.h>
#include <stdlib.h>
// a superfluous check for pedantic people
inline void CHECK_SUCCESS(int ret)
{
if (ret != 0)
{
abort();
@sergiopvilar
sergiopvilar / CamelCase.js
Created March 14, 2014 16:33
Check if a string is Camel Case using Javascript
String.prototype.toCamelCase = function(cap1st) {
'use strict';
return ((cap1st ? '-' : '') + this).replace(/-+([^-])/g, function(a, b) {
return b.toUpperCase();
});
};
function isCamelCase(str){
'use strict';
@ixe013
ixe013 / polyglot-listener.bat
Last active April 23, 2024 10:00
A polyglot batch file/JScript.net application that listens on a port. Try it with `polyglot-listener.bat 1234` to listen on port 1234
@if (@X)==(@Y) @end /* JScript comment
@echo off
REM Polyglot code adapted from https://stackoverflow.com/a/24396149/591064
setlocal enableDelayedExpansion
REM Too few arguments?
if "x%1" == "x" goto usage_help
REM Find the latest JScript.Net compiler
for /f "tokens=* delims=" %%v in ('dir /b /s /a:-d /o:-n "%SystemRoot%\Microsoft.NET\Framework\*jsc.exe"') do (

🛠️ Comment se connecter à la base de données pour un bot utilisant MySQL

Sur un ordinateur local

Tout d'abord, veuillez installer Xampp via ce lien qui est totalement sécurisé et gratuit: XAMPP.

Une fois que vous avez téléchargé et lancé l'application, vous arriverez sur ce tableau de bord. Veuillez cliquer sur les boutons encadrés en rouge :

@david-marconis
david-marconis / wsl-vpnkit-guide.md
Last active April 23, 2024 09:57
WSL vpn-kit quick guide with systemd
@ryanlintott
ryanlintott / CustomColorScheme.swift
Last active April 23, 2024 09:54
Custom color scheme view modifier for SwiftUI. Sets the color scheme to light mode, dark mode, or matches the system. If set to match, the app will respond to system-wide color scheme changes properly. A simple widget color scheme implementation is also provided.
import SwiftUI
enum CustomColorScheme: Int, CaseIterable, Identifiable, Codable {
static var defaultKey = "customColorScheme"
static var defaultValue = CustomColorScheme.system
case system = 0
case light = 1
case dark = 2
@dhh
dhh / linux-setup.sh
Last active April 23, 2024 09:53
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
git clone https://github.com/OpenDevin/OpenDevin.git
cd OpenDevin
conda create -n od python=3.10
conda activate od
docker ps
(optional) install docker if not already installed
docker pull ghcr.io/opendevin/sandbox
export OPENAI_API_KEY={your key}
(optional I had to install rust) curl --proto '=https' --tlsv1.2 -sSf [https://sh.rustup.rs](https://sh.rustup.rs/) | sh
(optional) restart terminal
@Ikki-Dai
Ikki-Dai / SpringDataJdbcConfiguration.java
Last active April 23, 2024 09:52
CustomerEnumConverter
@Configuration
@Slf4j
public class SpringDataJdbcConfiguration extends AbstractJdbcConfiguration {
@Override
public JdbcCustomConversions jdbcCustomConversions() {
return new JdbcCustomConversions(Arrays.asList(Enum2Integer.INSTANCE,
new Integer2Enum<>(Account.Gender.class)));
}