Skip to content

Instantly share code, notes, and snippets.

@hexadeciman
hexadeciman / rename_upper_lower.sh
Created June 7, 2023 15:02
Rename files in a directory from upper to lowercase
#!/bin/bash
# Loop through all files in the directory
for file in *; do
# Check if the file exists and is a regular file
if [[ -f "$file" ]]; then
# Convert the file name to lowercase
lowercase_name=$(echo "$file" | tr '[:upper:]' '[:lower:]')
# Rename the file to lowercase
#!/bin/bash
# Specify the directory path
directory="./"
# Change to the specified directory
cd "$directory" || exit
# Define the mapping array
declare -A mapping=(
@hexadeciman
hexadeciman / chaining_rxjs.ts
Last active November 25, 2019 08:12
Chaining RXJS
const loginEpic = actions$ =>
actions$.ofType(ActionTypes.LOGIN_REQUESTED)
.switchMap(
(loginAction) => Observable.ajax(POSTOptions('/api/login', loginAction.credentials),
(action, r) => ([r, action])
)
.switchMap(
([loginResponse, action]) => Observable.ajax(
GETOptions('/api/provider', [loginResponse.response.userToken, action.serviceProviderId] )
)
@hexadeciman
hexadeciman / hideTwitterAvatar.js
Created May 20, 2015 15:22
hide twitter avatar
<script>
//hide twitter avatar
var hideTwitterAttempts = 0;
function hideTwitterBoxElements() {
setTimeout( function() {
if ( $('[id*=twitter]').length ) {
$('[id*=twitter]').each( function(){
var ibody = $(this).contents().find( 'body' );
ibody.find( '.avatar' ).css( 'height', 0 );
ibody.find( '.avatar' ).css( 'width', 0 );
'use strict';
function ChangeMachine() {
var coins = {
'75p' : 75,
'15p' : 15,
'3p' : 3,
'1p' : 1,
'1/2p' : 0.5,
var x = req.param('x');
var y = req.param('y');
var z = req.param('z');
var undef = x && y && z;
if(undef == "undefined")
return false;
return true;
var x = req.param('x');
var y = req.param('y');
var z = req.param('z');
if( typeof x == 'undefined'
|| typeof y == 'undefined'
|| typeof z == 'undefined' )
return false;
return true;