Skip to content

Instantly share code, notes, and snippets.

@LokeshKumarES
LokeshKumarES / 3_Swapping_of_Two_Numbers_without_third_variable.c
Created August 12, 2019 05:19
Q.6 Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.
#include<Stdio.h>
int main()
{
int C, D, T;
printf("Enter the value of C: ");
scanf("%d", &C);
printf("Enter the value of D: ");
scanf("%d", &D);
; ----------------------------------------------------------------------------------------------------------------------
; Name ..........: TrayIcon library
; Description ...: Provide some useful functions to deal with Tray icons.
; AHK Version ...: AHK_L 1.1.13.01 x32/64 Unicode
; Original Author: Sean (http://goo.gl/dh0xIX) (http://www.autohotkey.com/forum/viewtopic.php?t=17314)
; Update Author .: Cyruz (http://ciroprincipe.info) (http://ahkscript.org/boards/viewtopic.php?f=6&t=1229)
; Mod Author ....: Fanatic Guru
; License .......: WTFPL - http://www.wtfpl.net/txt/copying/
; Version Date...: 2014 - 01 - 16
; Note ..........: Many people have updated Sean's original work including me but Cyruz's version seemed the most straight
/**
* Converts an ArrayBuffer to a String.
*
* @param buffer - Buffer to convert.
* @returns String.
*/
export default function arrayBufferToString(buffer: ArrayBuffer): string {
return String.fromCharCode.apply(null, Array.from(new Uint16Array(buffer)));
}
@h3ssan
h3ssan / JetBrains trial reset.md
Last active May 7, 2024 13:31
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these

@wosephjeber
wosephjeber / instructions.md
Last active May 7, 2024 13:31
Ecto migration for renaming table with indexes and constraints

Renaming table in Ecto migration

I recently wanted to rename a model and its postgres table in a Phoenix app. Renaming the table was simple and documented, but the table also had constraints, sequences, and indexes that needed to be updated in order for the Ecto model to be able to rely on default naming conventions. I couldn't find any examples of what this would look like but was eventually able to figure it out. For anyone else in the same situation, hopefully this example helps.

In the example below, I'm renaming the Permission model to Membership. This model belongs to a User and an Account, so it has foreign key constraints that need to be renamed.

defmodule MyApp.Repo.Migrations.RenamePermissionsToMemberships do
  use Ecto.Migration
@ckandoth
ckandoth / install_nextflow_singularity.md
Last active May 7, 2024 13:28
Install conda and use it to install nextflow and singularity

This guide will show you how to install conda and then use it to install nextflow and singularity for executing popular bioinformatics workflows. Unfortunately, singularity is not available on Windows or macOS. So, this guide will only target Linux environments. If you have to use Windows 10, then try WSL2. If you have to use macOS, then try a Virtual Machine.

Download the Miniconda3 installer for Linux environments:

curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh

Install into a folder named miniconda3 under your home directory, and delete the installer:

bash miniconda.sh -bup $HOME/miniconda3 && rm -f miniconda.sh
@MarcoLizza
MarcoLizza / scale_rotate.c
Last active May 7, 2024 13:28
Fast scale-and-rotate blit.
typedef unsigned char Pixel_t;
typedef struct _Point_t {
int x, y;
} Point_t;
typedef struct _Rectangle_t {
int x, y;
int width, height;
} Rectangle_t;
@romkatv
romkatv / migrate-zsh-dotfiles.zsh
Last active May 7, 2024 13:27
Migrate zsh dotfiles from the home directory to another directory on the same machine
# This command moves your zsh dotfiles (.zshrc, .zsh_history, etc.)
# from the home directory to ~/.config/zsh. It's been verified to
# work correctly if you are using zsh4humans. With other zsh configs
# your mileage may vary.
#
# How to:
#
# 1. Close all terminals except one.
# 2. Copy-paste this command into the only remaining terminal.
() {
@hyjk2000
hyjk2000 / .alacritty.yml
Created February 12, 2020 08:48
Alacritty with Tmux Setup
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
#env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
@HogeBlekker
HogeBlekker / flask.tsx
Last active May 7, 2024 13:27
Grafana Canvas Panel custom experimental element
import React from 'react';
import { ColorDimensionConfig, ScalarDimensionConfig } from '@grafana/schema';
import { DimensionContext } from 'app/features/dimensions';
import { ColorDimensionEditor, ScalarDimensionEditor } from 'app/features/dimensions/editors';
import { CanvasElementItem, CanvasElementProps, defaultBgColor } from '../element';
interface FlaskData {
height: number;